/*  GMooc - A Java web application for delivering massive open online courses
*   Copyright (C) 2012 Charles A. Wight
*   
*    This program is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, either version 3 of the License, or
*   (at your option) any later version.
*
*   This program is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.gmooc;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Id;

import com.googlecode.objectify.annotation.Cached;
import com.googlecode.objectify.annotation.Serialized;
import com.googlecode.objectify.annotation.Unindexed;

@Cached
public class Module implements Serializable {
	private static final long serialVersionUID = 137L;
	@Unindexed @Id Long id;
	String title;
	@Serialized List<Assignment> assignments = new ArrayList<Assignment>();
	
	Module() {}

	Module(String title) {
		this.title = title;
		assignments.add(new Assignment("Video",title + " - " + "Video"));
		assignments.add(new Assignment("Reading",title + " - " + "Reading"));
		assignments.add(new Assignment("Quiz",title + " - " + "Quiz"));
	}
		
	long getId() {
		return this.id;
	}

	String getTitle() {
		return title==null?"":title;
	}
	
	void setTitle(String t) {
		title = t;
	}
	
}